 package com.gmrz.uaf.protocol.v1.json;
 
 import com.google.gson.InstanceCreator;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonDeserializationContext;
 import com.google.gson.JsonDeserializer;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonParseException;
 import com.google.gson.JsonSerializationContext;
 import com.google.gson.JsonSerializer;
 import com.google.gson.reflect.TypeToken;
 import com.gmrz.uaf.protocol.v1.schema.ListSupportedSchemes;
 import com.gmrz.uaf.protocol.v1.schema.SupportedScheme;

 import java.lang.reflect.Type;

 public class ListSupportedSchemesAdapter
   implements InstanceCreator<ListSupportedSchemes<?>>, JsonSerializer<ListSupportedSchemes<?>>, JsonDeserializer<ListSupportedSchemes<?>>
 {
   public ListSupportedSchemes<?> createInstance(Type type)
   {
     return new ListSupportedSchemes();
   }
 
   public JsonElement serialize(ListSupportedSchemes<?> src, Type typeofSrc, JsonSerializationContext context)
   {
     Type t = new TypeToken() {  } .getType();
     return context.serialize(src, t);
   }
 
   public ListSupportedSchemes<?> deserialize(JsonElement json, Type typeofT, JsonDeserializationContext context)
     throws JsonParseException
   {
     ListSupportedSchemes retval = new ListSupportedSchemes();
     JsonArray array = json.getAsJsonArray();
     for (JsonElement e : array) {
       SupportedScheme c = new SupportedScheme().withScheme(SupportedScheme.Scheme.fromValue(e.getAsString()));
 
       retval.add(c);
     }
     return retval;
   }
 }
